function modaldemo(id) {
    $.get("/manage/getCompany", {
        id: id
    }, function(result) {
        if(id){
            $("#title").html("编辑职务");
           }else{
            $("#title").html("添加职务");
           }
        $("#role_name").val(result.role_name);
        $("#company").html(result.company);
        $("#id").val(id);
        $("#getlevel").html(result.level);
    });
    $("#modal-demo").modal("show")
}

//添加/修改
$(".btn-account").click(function() {
    var cid = $("#cid option:selected ").val();
    var role_name = $("#role_name").val();
    var level = $("#level").val();
    var id = $("#id").val();
    if (role_name == '') {
        parent.layer.msg("职务不能为空");
        return false
    }
    $.post("/manage/editPosition", {
        role_name: role_name,
        cid:cid,
        level:level,
        id:id
    }, function(result) {
        parent.layer.msg(result['msg']);
        if (result['code'] == 1) {
            $("#modal-demo").modal("hide");
            setTimeout(function() {
                window.location.reload();
            }, 1000)
        }
    })
})
